Repository navigation
feat: Cursor preCompact becomes a rius.compaction event (RIUS-1548) - #69
Conversation
… LLM span is flagged (RIUS-1548) The hook's trigger, context size, window and message counts become a rius.compaction event on the LLM span it interrupted; the cursor.context.* keys are unchanged. The next LLM span carries gen_ai.conversation.compacted, since Cursor never reports a size after. No real Cursor compaction was captured.
factory/review: PASS (round 1) @ 918231cPutting the compaction on the interrupted LLM span as an event, and building it from the whole spool, is the right shape for Cursor. Batching then can't move the event or the flag, and Verified
Findings (none blocking)F1 (P3): three surviving mutants in
F2 (P3, note): the flag moves to an unanswered turn at session end. In F3 (P3, note): a F4 (P3): the no-content test for Not verified
|
Ticket: RIUS-1548 (M3). Follows rius-coding-agents #67 (Claude Code) and #68 (Codex).
What changed
preCompacthook becomes arius.compactionspan event on the LLM span of the generation it interrupted: kindsummarize, executorclient,trigger(onlyautoormanual),tokens.before=context_tokens,context_window=context_window_size,messages.compacted=messages_to_compact,messages.kept=message_count - messages_to_compactwhen both are known and the result is not negative. Anything absent, non-numeric, bool or negative is left out.gen_ai.conversation.compacted = true, and no other (as in A37). Cursor never reports a size after a compaction, so this flag is what tells a reader a drop in context is a compaction. A turn with no LLM span yet passes the flag on; a hook that names no turn still flags the next call; a subagent's compaction is not ours.cursor.context.*keys are unchanged (argus-core reads them as a marker)._digestalready coversspan.events, so a span is resent when only its event changes (test added).docs/cursor.md(Compactions section), pointer indocs/how-it-works.md.Real compaction: NOT checked
No real captured
preCompactpayload exists in the repo (the tests reuse the shape of the docs-deriveddocs_session.json), and a real Cursor run needs a login, so none was made. Per the ticket the releaser keeps this change out of the plugin release PR until a real check is recorded. The protobuf decode e2e test is skipped here (opentelemetry-proto is not installed); the event was checked in the OTLP JSON body.Checks (head 918231c)
/usr/bin/python3 -m pytest -q tests/test_cursor_e2e.py tests/test_cursor_export.py tests/test_cursor_compaction.py: 74 passed, 1 skippedfactory-heavy 900 /usr/bin/python3 -m pytest -q: 1864 passed, 9 skippedtotal >= compacted(1 fails),events=on the LLM span (38 fail), the owed re-arm (the late-compaction test fails).Challenger
Round 1: one P2 (a late compaction could leave the next call unflagged). It was not a bug: the flag is cleared and then re-armed by the same turn's compaction. I pinned that case with
test_a_late_compaction_does_not_use_up_the_flag_it_owes_the_next_calland the second review passed. No waivers.Assumptions
None new.